class Accumulator {
    constructor() {
        this.count = 0;
        this.total = 0;
    }
    addDataValue(val) {
        let num = parseFloat(val, 10);
        if (!isNaN(num)) {
            this.total += num;
            this.count++;
        }
    }

    mean() {
        return this.total / this.count;
    }

    toString() {
        return 'mean of ' + this.count + ' numbes : ' + this.mean();
    }
}

module.exports = Accumulator;